//
// CVegetable.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CRGBAF;
import org.ryzom.nel.misc.CVector;
import org.ryzom.nel.misc.IStream;

public class CVegetable {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CVegetable(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CVegetable obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CVegetable(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public void setShapeName(String value) {
    nel3dJNI.CVegetable_ShapeName_set(swigCPtr, this, value);
  }

  public String getShapeName() {
    return nel3dJNI.CVegetable_ShapeName_get(swigCPtr, this);
  }

  public void setDensity(SWIGTYPE_p_NLMISC__CNoiseValue value) {
    nel3dJNI.CVegetable_Density_set(swigCPtr, this, SWIGTYPE_p_NLMISC__CNoiseValue.getCPtr(value));
  }

  public SWIGTYPE_p_NLMISC__CNoiseValue getDensity() {
    return new SWIGTYPE_p_NLMISC__CNoiseValue(nel3dJNI.CVegetable_Density_get(swigCPtr, this), true);
  }

  public void setMaxDensity(float value) {
    nel3dJNI.CVegetable_MaxDensity_set(swigCPtr, this, value);
  }

  public float getMaxDensity() {
    return nel3dJNI.CVegetable_MaxDensity_get(swigCPtr, this);
  }

  public void setSxy(SWIGTYPE_p_NLMISC__CNoiseValue value) {
    nel3dJNI.CVegetable_Sxy_set(swigCPtr, this, SWIGTYPE_p_NLMISC__CNoiseValue.getCPtr(value));
  }

  public SWIGTYPE_p_NLMISC__CNoiseValue getSxy() {
    return new SWIGTYPE_p_NLMISC__CNoiseValue(nel3dJNI.CVegetable_Sxy_get(swigCPtr, this), true);
  }

  public void setSz(SWIGTYPE_p_NLMISC__CNoiseValue value) {
    nel3dJNI.CVegetable_Sz_set(swigCPtr, this, SWIGTYPE_p_NLMISC__CNoiseValue.getCPtr(value));
  }

  public SWIGTYPE_p_NLMISC__CNoiseValue getSz() {
    return new SWIGTYPE_p_NLMISC__CNoiseValue(nel3dJNI.CVegetable_Sz_get(swigCPtr, this), true);
  }

  public void setRx(SWIGTYPE_p_NLMISC__CNoiseValue value) {
    nel3dJNI.CVegetable_Rx_set(swigCPtr, this, SWIGTYPE_p_NLMISC__CNoiseValue.getCPtr(value));
  }

  public SWIGTYPE_p_NLMISC__CNoiseValue getRx() {
    return new SWIGTYPE_p_NLMISC__CNoiseValue(nel3dJNI.CVegetable_Rx_get(swigCPtr, this), true);
  }

  public void setRy(SWIGTYPE_p_NLMISC__CNoiseValue value) {
    nel3dJNI.CVegetable_Ry_set(swigCPtr, this, SWIGTYPE_p_NLMISC__CNoiseValue.getCPtr(value));
  }

  public SWIGTYPE_p_NLMISC__CNoiseValue getRy() {
    return new SWIGTYPE_p_NLMISC__CNoiseValue(nel3dJNI.CVegetable_Ry_get(swigCPtr, this), true);
  }

  public void setRz(SWIGTYPE_p_NLMISC__CNoiseValue value) {
    nel3dJNI.CVegetable_Rz_set(swigCPtr, this, SWIGTYPE_p_NLMISC__CNoiseValue.getCPtr(value));
  }

  public SWIGTYPE_p_NLMISC__CNoiseValue getRz() {
    return new SWIGTYPE_p_NLMISC__CNoiseValue(nel3dJNI.CVegetable_Rz_get(swigCPtr, this), true);
  }

  public void setBendFactor(SWIGTYPE_p_NLMISC__CNoiseValue value) {
    nel3dJNI.CVegetable_BendFactor_set(swigCPtr, this, SWIGTYPE_p_NLMISC__CNoiseValue.getCPtr(value));
  }

  public SWIGTYPE_p_NLMISC__CNoiseValue getBendFactor() {
    return new SWIGTYPE_p_NLMISC__CNoiseValue(nel3dJNI.CVegetable_BendFactor_get(swigCPtr, this), true);
  }

  public void setBendPhase(SWIGTYPE_p_NLMISC__CNoiseValue value) {
    nel3dJNI.CVegetable_BendPhase_set(swigCPtr, this, SWIGTYPE_p_NLMISC__CNoiseValue.getCPtr(value));
  }

  public SWIGTYPE_p_NLMISC__CNoiseValue getBendPhase() {
    return new SWIGTYPE_p_NLMISC__CNoiseValue(nel3dJNI.CVegetable_BendPhase_get(swigCPtr, this), true);
  }

  public void setBendFrequencyFactor(float value) {
    nel3dJNI.CVegetable_BendFrequencyFactor_set(swigCPtr, this, value);
  }

  public float getBendFrequencyFactor() {
    return nel3dJNI.CVegetable_BendFrequencyFactor_get(swigCPtr, this);
  }

  public void setColor(SWIGTYPE_p_NLMISC__CNoiseColorGradient value) {
    nel3dJNI.CVegetable_Color_set(swigCPtr, this, SWIGTYPE_p_NLMISC__CNoiseColorGradient.getCPtr(value));
  }

  public SWIGTYPE_p_NLMISC__CNoiseColorGradient getColor() {
    return new SWIGTYPE_p_NLMISC__CNoiseColorGradient(nel3dJNI.CVegetable_Color_get(swigCPtr, this), true);
  }

  public void setDistType(long value) {
    nel3dJNI.CVegetable_DistType_set(swigCPtr, this, value);
  }

  public long getDistType() {
    return nel3dJNI.CVegetable_DistType_get(swigCPtr, this);
  }

  public CVegetable() {
    this(nel3dJNI.new_CVegetable(), true);
  }

  public void setAngleGround(float cosAngleMin) {
    nel3dJNI.CVegetable_setAngleGround(swigCPtr, this, cosAngleMin);
  }

  public void setAngleCeiling(float cosAngleMax) {
    nel3dJNI.CVegetable_setAngleCeiling(swigCPtr, this, cosAngleMax);
  }

  public void setAngleWall(float cosAngleMin, float cosAngleMax) {
    nel3dJNI.CVegetable_setAngleWall(swigCPtr, this, cosAngleMin, cosAngleMax);
  }

  public float getCosAngleMin() {
    return nel3dJNI.CVegetable_getCosAngleMin(swigCPtr, this);
  }

  public float getCosAngleMax() {
    return nel3dJNI.CVegetable_getCosAngleMax(swigCPtr, this);
  }

  public CVegetable.TAngleType getAngleType() {
    return CVegetable.TAngleType.swigToEnum(nel3dJNI.CVegetable_getAngleType(swigCPtr, this));
  }

  public void registerToManager(CVegetableManager manager) {
    nel3dJNI.CVegetable_registerToManager(swigCPtr, this, CVegetableManager.getCPtr(manager), manager);
  }

  public void generateGroup(CVector posInWorld, CVector surfaceNormal, float area, long vegetSeed, SWIGTYPE_p_std__vectorT_NLMISC__CVector2f_t instances) {
    nel3dJNI.CVegetable_generateGroup(swigCPtr, this, CVector.getCPtr(posInWorld), posInWorld, CVector.getCPtr(surfaceNormal), surfaceNormal, area, vegetSeed, SWIGTYPE_p_std__vectorT_NLMISC__CVector2f_t.getCPtr(instances));
  }

  public void generateGroupBiLinear(CVector posInWorld, CVector posInWorldBorder, CVector surfaceNormal, float area, long vegetSeed, SWIGTYPE_p_std__vectorT_NLMISC__CVector2f_t instances) {
    nel3dJNI.CVegetable_generateGroupBiLinear(swigCPtr, this, CVector.getCPtr(posInWorld), posInWorld, CVector.getCPtr(posInWorldBorder), posInWorldBorder, CVector.getCPtr(surfaceNormal), surfaceNormal, area, vegetSeed, SWIGTYPE_p_std__vectorT_NLMISC__CVector2f_t.getCPtr(instances));
  }

  public void reserveIgAddInstances(CVegetableInstanceGroupReserve vegetIgReserve, CVegetable.TVegetableWater vegetWaterState, long numInstances) {
    nel3dJNI.CVegetable_reserveIgAddInstances(swigCPtr, this, CVegetableInstanceGroupReserve.getCPtr(vegetIgReserve), vegetIgReserve, vegetWaterState.swigValue(), numInstances);
  }

  public void generateInstance(CVegetableInstanceGroup ig, SWIGTYPE_p_NLMISC__CMatrix posInWorld, CRGBAF modulateAmbientColor, CRGBAF modulateDiffuseColor, float blendDistMax, CVegetable.TVegetableWater vegetWaterState, CVegetableUV8 dlmUV) {
    nel3dJNI.CVegetable_generateInstance(swigCPtr, this, CVegetableInstanceGroup.getCPtr(ig), ig, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(posInWorld), CRGBAF.getCPtr(modulateAmbientColor), modulateAmbientColor, CRGBAF.getCPtr(modulateDiffuseColor), modulateDiffuseColor, blendDistMax, vegetWaterState.swigValue(), CVegetableUV8.getCPtr(dlmUV), dlmUV);
  }

  public void serial(IStream f) {
    nel3dJNI.CVegetable_serial(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public final static class TVegetableWater {
    public final static TVegetableWater AboveWater = new TVegetableWater("AboveWater", nel3dJNI.CVegetable_AboveWater_get());
    public final static TVegetableWater UnderWater = new TVegetableWater("UnderWater");
    public final static TVegetableWater IntersectWater = new TVegetableWater("IntersectWater");
    public final static TVegetableWater VegetInfoLast = new TVegetableWater("VegetInfoLast");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TVegetableWater swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TVegetableWater.class + " with value " + swigValue);
    }

    private TVegetableWater(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TVegetableWater(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TVegetableWater(String swigName, TVegetableWater swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TVegetableWater[] swigValues = { AboveWater, UnderWater, IntersectWater, VegetInfoLast };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

  public final static class TAngleType {
    public final static TAngleType AngleGround = new TAngleType("AngleGround", nel3dJNI.CVegetable_AngleGround_get());
    public final static TAngleType AngleCeiling = new TAngleType("AngleCeiling");
    public final static TAngleType AngleWall = new TAngleType("AngleWall");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TAngleType swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TAngleType.class + " with value " + swigValue);
    }

    private TAngleType(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TAngleType(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TAngleType(String swigName, TAngleType swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TAngleType[] swigValues = { AngleGround, AngleCeiling, AngleWall };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
